Learning Objectives

After completing this lesson, you’ll be able to:

What is Group By?

Group By parameters allow features to be processed in groups by a single FME transformer.

FME transformers perform transformations on either one feature at a time or a whole set of features at once.

Creating Groups

A group is a defined set of features processed by a transformer. By default, group-based transformers treat all the features they receive as a single group.

However, such transformers also have a Group By parameter. This parameter lets the user define several groups based on an attribute's value.

Note

To illustrate groups, let's consider calculating the mean age of FME users. The default group for the calculation includes all FME users.

But you could instead divide everyone by their nationality and calculate the average age per country.

This is the same as having a nationality attribute in a dataset and selecting that in an FME Group By parameter.

Here, a Dissolver transformer is used to dissolve (merge) several polygon features. The selected Group By attribute is ViewDescription. Additionally, you can choose to set Complete Groups to When All Features Received, which makes the Dissolver a blocking transformer, or to When Group Changes (Advanced). The latter option should only be used when your data is sorted by the value(s) of the grouping attribute(s). It can offer a performance boost if your data is already sorted or if you are processing a large number of records.

Setting a Group By parameter

FME creates a series of groups for overlaying, where the features in each group share the same value for the ViewDescription attribute. The practical outcome is that polygon dissolving takes place only where line features share the same description:

Example of results of using a Dissolver on geometry

Group By Mode

When grouping features, the transformer can handle the group in two different ways. The first way is to hold all of the features until all of the features have come through the transformer; this is referred to as blocking. This is set using the Process at End (Blocking) Group By Mode.

The other way is to pre-sort your data into groups using a transformer like the Sorter. Then, once your data is grouped, use the Process When Group Changes (Advanced) Group By Mode. This mode will push the features through the transformer after each group, which will help speed up performance. Only use this option when your data is pre-sorted.